package com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.systemsetup;

import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseService;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.utils.requestutil.HttpRequestUtil;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Service
@Slf4j
public class DepartmentService extends BaseService {

	private static final Logger logger = LoggerFactory.getLogger(DepartmentService.class);

	@Resource
    HttpServletRequest httpServletRequest;
	HttpResponse httpResponse;

	/**
	 * 部门树形菜单（单位账号登录-系统设置中用）
	 * @param
	 * @return
	 */
	public RespEntity departmentTree(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return systemsetupJava(jsonParam,"departmentTree","department");
	}
	/**
	 * 部门新增
	 * @param
	 * @return
	 */
	public RespEntity departmentAdd(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return systemsetupJava(jsonParam,"departmentAdd","department");
	}

	/**
	 * 部门修改
	 * @param
	 * @return
	 */
	public RespEntity departmentUpdate(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return systemsetupJava(jsonParam,"departmentUpdate","department");
	}

	/**
	 * 部门删除
	 * @param
	 * @return
	 */
	public RespEntity departmentDelete(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return systemsetupJava(jsonParam,"departmentDelete","department");
	}

	/**
	 * 部门详情
	 * @param
	 * @return
	 */
	public RespEntity departmentDetail(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return systemsetupJava(jsonParam,"departmentDetail","department");
	}
}
